
{extend name="common/public" /}
{block name="content"}
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
    <div class="widget am-cf">
        <div class="widget-head am-cf">
            <div class="widget-title am-fl">兑换订单</div>
            <div class="widget-function am-fr">
                <a href="javascript:;" class="am-icon-cog"></a>
            </div>
        </div>
        <form action="{:url()}">
            <input type="text" style="width: 300px" value="{$Request.get.searchWords}" name="searchWords" placeholder="订单号|下单人|电话号码|搜索"/>
            <select name="status" data-am-selected="{searchBox: 2}">
                <option value="5" {eq name="info.status" value="5"}selected{/eq}>全部</option>
                <option value="0" {eq name="info.status" value="0"}selected{/eq}>待发货</option>
                <option value="1" {eq name="info.status" value="1"}selected{/eq}>已发货</option>
                <option value="2" {eq name="info.status" value="2"}selected{/eq}>已完成</option>
            </select>
            <button type="submit" class="am-btn am-btn-xs am-btn-default am-btn-success"><span class="am-icon-search"></span> 确定</button>
        </form>
        <div class="widget-body  widget-body-lg am-fr">

            <table width="100%" class="am-table am-table-compact am-table-bordered tpl-table-black ">
                <thead>

                <tr>
                                            <th class="am-lg-text-center">
                                                        编号</th>
                                            <th class="am-lg-text-center">
                                                        头像</th>
                                            <th class="am-lg-text-center">
                                                        商品图片</th>
                                            <th class="am-lg-text-center">
                                                        商品名</th>
                                            <th class="am-lg-text-center">
                                                        兑换数量</th>
                                            <th class="am-lg-text-center">
                                                        使用积分</th>
                                            <th class="am-lg-text-center">
                                                        下单人</th>
                                            <th class="am-lg-text-center">
                                                        下单人电话</th>
                    <th class="am-lg-text-center">
                        订单状态</th>
                                            <th class="am-lg-text-center">
                                                创建时间</th>

                                        <th>操作</th>
                </tr>
                </thead>
                <tbody>
                
                    {foreach $list as $v}
                
                <tr class="gradeX">
                    <td class='am-lg-text-center'>                                {$v.id}</td>
                    <td class='am-lg-text-center'>       <img src="{$v.headimgurl}" style="width: 80px;height: 80px;">                         </td>
                        
                    <td class='am-lg-text-center'>                 <img src="{$v.goods_images}" onclick="window.open('{$v.goods_images}')" style="width: 90px;height: 90px;"></td>
                        
                    <td class='am-lg-text-center'>                                {$v.goods_title}</td>
                        
                    <td class='am-lg-text-center'>                                {$v.number}</td>
                        
                    <td class='am-lg-text-center'>                                {$v.integral}</td>
                        
                    <td class='am-lg-text-center'>                                {$v.true_name}</td>
                        
                    <td class='am-lg-text-center'>                                {$v.phone}</td>
                        

                        
                    <td class='am-lg-text-center' style="color: red;">                {$v.status ==0?"待发货":""}{$v.status ==1?"已发货":""}{$v.status ==2?"已确认":""}</td>
                    <td class='am-lg-text-center'>                                {$v.create_time}</td>
                                            <td>
                            
                            <div class="tpl-table-black-operation">
                                <a onclick="openUrl('{:url('info',['id'=>$v['id']])}')">
                                    <i class="am-icon-pencil"></i> 详情
                                </a>
                                {eq name="$v.status" value="0"}
                                    <a href="javascript:;" onclick="fahuo('{$v.id}')">
                                        <i class="am-icon-edit"></i> 发货
                                    </a>
                                {/eq}
                            </div>
                            
                        </td>

                </tr>
                
                    {/foreach}
                


                </tbody>
            </table>
            
                {$list|raw}
            
        </div>
    </div>
</div>

    {/block}

    {block name="script"}

        <script type="text/javascript">
            function fahuo(id) {
                var index =  layer.confirm('确定要发货？',function () {
                    $.post('{:url("fahuo")}',{id:id},function (result) {
                        if(result.code!=0){
                            layer.alert(result.msg,{icon:5})
                        }else{
                            window.location.reload();
                        }
                    })
//                    layer.close(index)
                })
            }
        </script>
    {/block}
    {/extend}
